<template>
	<view class="page">
		<view class="banner animated fadeIn">
			<u-image width="750rpx" height="360rpx" lazy-load border-radius="4" :src="'https://qny.hongfyun.com/2.jpg'||errLoadImg" mode="scaleToFill">
				<image :src="loadingImg" style="width: 205rpx;height: 160rpx;"  slot="loading"></image>
				<image :src="errLoadImg" style="width: 205rpx;height: 160rpx;" slot="error"></image>
			</u-image>
		</view>

		<view class="p-2">
			<block v-for="(item, i) in serviceList" :key="i">
				<serverListItem @click.native="itemBtnTap(item.id)" :item="item" :index="i"></serverListItem>
			</block>
		</view>
	</view>
</template>

<script>
import { mapGetters } from 'vuex';

import serverListItem from '@/components/enterprise/server_list_item.vue';

import { serveProject } from '@/api/enterprise/index.js';
export default {
	components: {
		serverListItem
	},
	data() {
		return {
			serviceList:[],
			loadingImg:'/static/images/timg.gif',
			errLoadImg:'/static/images/errLoad.jpeg',
		};
	},
	computed: {
		...mapGetters(['token'])
	},
	onReady() {
		this.getServiceList();
	},
	methods: {
		async getServiceList() {
			const {result:res} = await serveProject();
			this.serviceList = res
			console.log(res,1111);
		},
		itemBtnTap(id) {
			if (!this.token) {
				uni.showToast({
					title: '请登录！！！',
					icon: 'none',
					success: () => {
						uni.reLaunch({
							url: '/pages/login/login'
						});
					}
				});

				return false;
			}

				uni.setStorageSync('token',this.token)
			// if(key==='banshi'){
			// 	this.$u.toast('暂无')
			// 	return
			// }

			uni.navigateTo({
				url: '/pages/property/page_item/property_fix/property_fix?id=' + id
				// url: 'page_item/property_fix/property_fix?key=' + key
			});
		}
	}
};
</script>

<style lang="scss">
.page {
	background-color: #fffdfd;
}
.banner {
	width: 750rpx;
	height: 360rpx;
	image {
		width: 100%;
		height: 100%;
	}
}
</style>
